package compiler;
import java.awt.Event;
import java.awt.Frame;
import java.awt.TextArea;

class TextEditor extends TextArea
{
	int cursorX = 1;
    int cursorY = 1;

    Frame parent;

	TextEditor(Frame p, int cl, int rw)
	{
		super(cl, rw);
		parent = p;
	}

    public boolean keyUp(Event evt, int key)
    {
        boolean result = super.keyUp(evt, key);
        GetSeat();
        return result;
    }

    private void GetSeat()
    {
        String buf = getText();
        int ss = getSelectionStart();
        //if (ss < buf.length()) ss = ss - 1;
        cursorX = 1; cursorY = 1;
        for (int count = 0; count < ss; count++)
        {
            if (buf.charAt(count) != '\n') cursorX ++;
            else
            {
                cursorY++; cursorX = 1;
            }
        }
    }

}

